Package test

Source Code of test.LoadProperties1

/*
* Created on Oct 25, 2003
*
* To change the template for this generated file go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
package test;

import java.io.*;
import java.util.Properties;

/**
* @author johnz
*
* To change the template for this generated type comment go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
public class LoadProperties1 {

  public static void main(String[] args)
    throws Exception {
   
    // When running via Ant we pass root folder as argument
    String rootFolder = "";
    if (args.length == 1) {
      rootFolder = args[0] + "/";
    }   

    System.getProperties().list(System.out);
    File projectFile = new File(rootFolder + "resource/project.properties");
    if (!projectFile.exists()) {
      System.out.println("Properties file doews not exist: " + projectFile);
    }
   
    FileInputStream fis = new FileInputStream(projectFile);
    Properties projectProperties = new Properties();
    projectProperties.load(fis);
    fis.close();
    projectProperties.list(System.out);
   
  }
}
TOP

Related Classes of test.LoadProperties1

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.